@extends('admin.layout')
@section('content')
 <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                分类管理
                <small>修改</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 后台主页</a></li>
                <li><a href="#">分类管理</a></li>
                <li class="active">修改信息</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">修改信息</h3>
                        </div><!-- /.box-header -->
               
                        <!-- form start -->
                        <form role="form" action="{{ url('/admin/sort/update')}}" method='post'>
                            {{csrf_field()}}
                            <div class="box-body">
                         @if (count($errors) > 0)
                             <div class="alert alert-danger">
                               <ul>
                                 @foreach ($errors->all() as $error)
                                   <li>{{ $error }}</li>
                                 @endforeach
                               </ul>
                             </div>
                         @endif

                                 <input type='hidden' name='id' value="{{ $data -> id }}">
                                <div class="form-group">
                                    <label for="exampleInputEmail1">分类名</label>
                                    <input type="text" value="{{$data -> name}}" class="form-control" id="username" name="name">
                                </div>
                                <div class="form-group">
                                    <label>父分类</label>
                                    <select class="form-control" name='pid'>
                                        <option value='0'>根分类</option>
                                      @foreach($allData as $obj)
                                       
                                            <option 
                                            @if($data -> pid == $obj -> id) 
                                              selected='selected'  
                                            @endif 
                                            @if($data -> id == $obj ->id)
                                              disabled='disabled'
                                            @endif
                                            value="{{$obj -> id}}">{{$obj -> name}}</option>
                                          
                                      @endforeach
                                    </select>
                                 </div>
                             
                                <button type="submit" class="btn btn-primary">修改</button>
                                <button type="reset" class="btn btn-default">重置</button>
                            </div>
                        </form>
                    </div><!-- /.box -->

                   
                   
                    <!-- Input addon -->
              
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection